import request from '@/utils/request'
/** *
 * 获取组织架构数据
 * **/
export function reqGetDepartments() {
  return request({
    url: '/company/department'
  })
}

// 删除部门
export const reqDelDEpartment = id =>
  request({ method: 'delete', url: `/company/department/${id}` })

/**
 * 新增部门接口
 **/
export function reqAddDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/** *
 * 获取部门详情
 * ***/
// 根据id查询部门详情
export const reqGetDepartDetail = id =>
  request({ url: `/company/department/${id}` })

/**
 * 编辑部门
 ***/
export function reqUpdateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    // get/ delete 携带参数 params   ----- post put patch 携带参数用data
    data
  })
}
